<%--
  Created by IntelliJ IDEA.
  User: 李烨卿
  Date: 2018/4/24
  Time: 13:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <script type="text/javascript"  src="./jquery/jquery.min.js"></script>
    <!-- 表格 -->
    <link rel="stylesheet"	href="./bootstrap/bootstrap-table/dist/bootstrap-table.min.css">
    <script type="text/javascript"	src="./bootstrap/bootstrap-table/dist/bootstrap-table.min.js"></script>
    <!-- 汉化分页 -->
    <script type="text/javascript"	src="./bootstrap/bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js"></script>

</head>
<body>

<form  method="post" >
    <div class="form-group">
        <label for="chongzhinum">充值金额</label>
        <input type="text" class="form-control" id="chongzhinum" placeholder="充值金额" name="rechargenum">
    </div>
    <div class="form-group">
        <label for="banknum">银行卡</label>
        <select id='banknum' class="form-control selectpicker"   name="bankcardnumber" ></select>

    </div>

    <input type="button" class="btn btn-default" value="充值" onclick="chongzhi()"/>

</form>

<script type="text/javascript">
//银行卡查询(回显)
    $.ajax({

        url:"http://localhost:8680/app/balance/querycardinfo",
        type: "GET",
       // dataType:"json",
        success: function (result) {

            //alert(result.cardnumberlist[1].bankcardnumber)
            result=eval("("+result+")")

            var list=result.cardnumberlist

            for (var i = 0; i < list.length; i++) {

                $('#banknum').append("<option value="+list[i].bankcardnumber+">" + list[i].bankcardnumber + "</option>")

            }

        }
    });
function chongzhi() {

    var rechargenum=$("#chongzhinum").val()

    $.ajax({
        url : "http://localhost:8680/app/balance/saverecharge",
        type : "PUT",
        data : {"rechargenum":rechargenum},
        success:function(result){

            //result=eval("("+result+")")

                alert(result.message)

            history.go(0)
        }

    })
}

</script>

</body>
</html>
